;; Sri Ganeshji : Sri Balaji : Sri Pitreshwarji : Sri Durgaji : Sri Venkateshwara

/*
Objective(s) -
-	This code introduces the concept of User Defined Functions with a Exponential
	Function

Last Modification -
-	Altered on 09-11-2009

Dependencies -
-	Supporting files 'Simple Interest.txt'
*/

[Report: Exponential Calculator]

	Use		: Simple Interest Calculator
	Local	: Field	: Default			: Type		: Number
	Local	: Field	: Default			: Format	: "Zero, Comma"

	Local	: Form	: Interest Calc		: Local		: Field	: Form SubTitle	: Info		: "Exponential Calculator"

	Local	: Line	: Interest Principal: Local		: Field	: Medium Prompt	: Info		: "Exponential of (x) :"
	Local	: Field	: Interest Principal: Set As	: 0

	Local	: Line	: Interest Rate		: Invisible	: Yes

	Local	: Line	: Interest NoOfYrs	: Local		: Field	: Medium Prompt	: Info		: "To the Power (n) :"
	Local	: Field	: Interest NoOfYrs	: Set As	: 0

	Local	: Line	: Interest Result	: Local		: Field	: Medium Prompt	: Info		: "Result (Exp):"
	Local	: Line	: Interest Result	: Local		: Field	: Default		: Inactive	: No
	Local	: Field	: Interest Result	: Set As	: $$Exponential:#InterestPrincipal:#InterestNoOfYrs

;; Function to calculate Exponential of a Number

[Function: Exponential]

;; Definition Block

	Parameter	: X 		: Amount
	Parameter	: T			: Number
	Returns		: Amount

	Variable	: ExpResult	: Amount
	Variable	: Counter	: Number

;; Procedural Block

	01 : SET 	: Counter	: 0
	02 : SET	: ExpResult	: 1

	03 : WHILE	: (##Counter < ##T)
	04 : 	SET			: ExpResult		: ##ExpResult * ##X
	05 : 	INCREMENT	: Counter
	06 : END WHILE
	
	07 : RETURN	: ##ExpResult

;; End-of-File
